home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10414 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: newsfeed.internetmci.com!xmission!inteleNET!usenet
  2. From: langj@jcave.com (Jonathan Lang)
  3. Newsgroups: comp.lang.c++,comp.sys.sgi.misc
  4. Subject: Re: What is the best way to initialize static template members?
  5. Date: Fri, 08 Mar 1996 02:07:54 GMT
  6. Organization: inteleNET Internet Services
  7. Message-ID: <4ho162$io5@vodka.intele.net>
  8. References: <313799EF.41C6@mozart.nmrcore.uab.edu> <313AAA8D.41C6@rus.uni-stuttgart.de>
  9. NNTP-Posting-Host: p133.jcave.com
  10. X-Newsreader: Forte Free Agent 1.0.82
  11.  
  12. Andreas Wierse <wierse@rus.uni-stuttgart.de> wrote:
  13.  
  14. >Hunter Moseley wrote:
  15. >> 
  16. >> What is the best way to initialize static template members?
  17. >> 
  18. >> Example:
  19. >> 
  20. >> template<class T>
  21. >> class X
  22. >>   {
  23. >>   private :
  24. >>     static int min_buff_size;
  25. >>   ...
  26. >>   };
  27. >> 
  28. >> What is the best way to initialize min_buff_size for a given
  29. >> X<T> class?
  30.  
  31. >I don't know what's the best way, but I know what works for me :-).
  32.  
  33. >I maintain a library and all static member initialization takes place
  34. >in a file named ec_statics.C. One line for example looks like the 
  35. >following:
  36.  
  37. >List<MMapEntry> *Malloc_tmp::mmaplist = new List<MMapEntry>;
  38.  
  39. >Applied to your case this would look like:
  40.  
  41. >X<T> X::min_buff_size = 100;
  42.  
  43. >Note, that in my case even the static variable that is initialized 
  44. >depends on the template.
  45.  
  46. >I use C++ 4.0 under IRIX 5.3 on my Indigo.
  47.  
  48. >You can read more about this in the ARM, section 9.4, pp. 179-181.
  49.  
  50. First, wouldn't this be:
  51.  
  52. int X<T>::min_buff_size = 100;
  53.  
  54. ?
  55.  
  56. Second, what is ARM?
  57. -- Jonathan Lang (langj@jcave.com)
  58.  
  59.